<!-- ProductInfo 页 -->
<template>
  <div v-model="info"
       class="ProductInfo">
    <el-form v-if="info?true:false"
             ref="form"
             v-model="info"
             label-width="100px">

      <el-row :gutter="24">

        <el-col :span="12"
                :offset="0">
          <el-form-item label="商品名称:">
            <el-input v-model="info.name"
                      :disabled="true" />
          </el-form-item>
        </el-col>

        <el-col :span="12"
                :offset="0">
          <el-form-item label="店铺名称:">
            <el-input v-model="info.business.company_name"
                      :disabled="true" />
          </el-form-item>
        </el-col>

      </el-row>

      <el-row :gutter="24">
        <el-col :span="24">
          <el-form-item label="商品图片:">
            <div class="productImg">
              <!-- <viewer :images="imgUrls+info.image">
                <img :src="imgUrls+info.image"
                     style="height: 300px; width: 400px;">
              </viewer> -->
              <el-image :src="imgUrls+info.image"
                        style="height: 300px; width: 400px;"
                        :preview-src-list="imgUrls+info.image" />
            </div>
          </el-form-item>
        </el-col>
      </el-row>

      <el-row :gutter="24">

        <el-col :span="24">
          <el-form-item label="商品轮播图:">
            <el-carousel height="400px"
                         indicator-position="none"
                         type="card">
              <el-carousel-item v-for="(item,index) in info.slider_image"
                                :key="index">
                <!-- <viewer :images="info.slider_image">
                  <img :src="imgUrls+item.img_url"
                       style="height: 100%; width: 100%;">
                </viewer> -->
                <!-- <img :src="imgUrls+item.img_url"
                     style="height: 100%; width: 100%;"> -->
                <el-image :src="imgUrls+item.img_url"
                          style="height: 300px; width: 400px;"
                          :preview-src-list="imgUrls+item.img_url" />
              </el-carousel-item>
            </el-carousel>
          </el-form-item>
        </el-col>

      </el-row>

    </el-form>
  </div>
</template>

<script>
export default {
  props: {
    value: {
      default: null
    }
  },
  data () {
    return {
      imgUrls: this.$baseUrl
    }
  },
  computed: {
    info: {
      get () {
        console.log('get => value', this.value)
        return this.value
      },
      set (val) {
        this.$emit('input', val)
      }
    }
  }
}
</script>
<style lang="scss" scoped>
/* @import url(); 引入css类 */
.ProductInfo {
  .productImg {
    text-align: left;
  }
}
</style>
